package com.bawei.goods.hospital_goods.controller;

import java.util.Arrays;
import java.util.Map;

import com.bawei.common.utils.PageUtils;
import com.bawei.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.bawei.goods.hospital_goods.entity.SeckillListEntity;
import com.bawei.goods.hospital_goods.service.SeckillListService;




/**
 * 
 *
 * @author doujunxian
 * @email 602137101@gmail.com
 * @date 2021-12-09 18:45:27
 */
@RestController
@RequestMapping("hospital_goods/seckilllist")
public class SeckillListController {
    @Autowired
    private SeckillListService seckillListService;

    /**
     * 查询秒杀商品
     */
     @GetMapping("Lates1DaySession")
     public R lates1DaySession(){

         return seckillListService.getGood();
     }

    /**
     * 列表
     */
    @PostMapping("/list")
        public R list(@RequestParam Map<String, Object> params){
        PageUtils page = seckillListService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
        public R info(@PathVariable("id") Integer id){
		SeckillListEntity seckillList = seckillListService.getById(id);

        return R.ok().put("seckillList", seckillList);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
        public R save(@RequestBody SeckillListEntity seckillList){
		seckillListService.save(seckillList);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
        public R update(@RequestBody SeckillListEntity seckillList){
		seckillListService.updateById(seckillList);

        return R.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
        public R delete(@RequestBody Integer[] ids){
		seckillListService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
